import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Transformer;


public class CollectionUtilsTest
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		Dummy d1 = new Dummy("dummy 1", "alias 1");
		Dummy d2 = new Dummy("dummy 2", "alias 2");
		Dummy d3 = new Dummy("dummy 2", "alias 2");
		
		List origList = new ArrayList();
		origList.add(d1);
		origList.add(d2);
		origList.add(d3);
		System.out.println("Original list -------------");
		System.out.println(origList);
		
		List transformed = (List) CollectionUtils.collect(origList, new Transformer() 
		{
			public Object transform(Object input)
			{
				Dummy dummy = (Dummy) input;
				return dummy.alias;
			}
		});		
		System.out.println("Transformed list ------------");
		System.out.println(transformed);
		
		Set outputSet = new HashSet(transformed);
		System.out.println("Output set --------------");
		System.out.println(outputSet);
		
		String ssnStr = "000123456";
		Long ssn = Long.valueOf(ssnStr);Long.parseLong(ssnStr);
		System.out.println("ssnStr: " + ssnStr);
		System.out.println("ssn: " + ssn);
	}

}

class Dummy 
{
	public String name;
	public String alias;
	
	public Dummy(String name, String alias)
	{
		this.name = name;
		this.alias = alias;
	}
	
	public String toString()
	{
		return name;
	}
}

